package com.ch01.factory;

import com.ch01.service.impl.TeacherServiceImpl;
import org.springframework.beans.factory.FactoryBean;

/**
 * @ClassName TeacherServiceFactoryBean
 * @Description 自定义FactoryBean对象, 必须实现spring提供的FactoryBean接口
 * @Author Kx
 * @Date 2025/4/27 10:08
 * @Version 1.0
 */
public class TeacherServiceFactoryBean implements FactoryBean {
    /***
     * @author: kx
     * @date: 2025/4/27 10:10
     * @return java.lang.Object
     * @description: 工厂方法: 将创建的对象纳入容器管理
    */
    @Override
    public Object getObject() throws Exception {
        return new TeacherServiceImpl();
    }

    /**
     * @author: kx
     * @date: 2025/4/27 10:10
     * @return java.lang.Class<?>
     * @description: 获取Bean的class类型
    */
    @Override
    public Class<?> getObjectType() {
        return TeacherServiceImpl.class;
    }

    /**
     * @author: kx
     * @date: 2025/4/27 10:11
     * @return boolean
     * @description: 是否是以单例模式管理(默认是以单例模式管理)
    */
//    @Override
//    public boolean isSingleton() {
//        return true;
//    }
}
